# Contributor: Sheila Aman <sheila@vulpine.house>
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=socat
pkgver=1.8.0.1
pkgrel=0
pkgdesc="Multipurpose relay for binary protocols"
# test  58 CHILDDEFAULT: child process default properties... FAILED:
# ./socat -t 0.1  -u exec:./procan -
options="!check"
url="http://www.dest-unreach.org/socat/"
arch="all"
license="GPL-2.0-only WITH OpenSSL-Exception"
makedepends="openssl-dev>3 readline-dev linux-headers"
checkdepends="bash"
subpackages="$pkgname-doc $pkgname-scripts"
source="http://www.dest-unreach.org/socat/download/socat-$pkgver.tar.gz
	use-linux-headers.patch
	netdb-internal.patch
	"

build() {
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr
	make
}

check() {
	make test
}

doc() {
	default_doc
	mkdir -p "$subpkgdir"/usr/share/socat/
	install -m644 "$builddir"/EXAMPLES "$builddir"/doc/*.html "$builddir"/doc/*.css "$subpkgdir"/usr/share/"$pkgname"/
}

package() {
	make DESTDIR="$pkgdir" install
}

scripts() {
	pkgdesc="$pkgdesc (helper scripts)"
	depends="$pkgname=$pkgver-r$pkgrel bash"

	amove usr/bin/socat-*.sh
}

sha512sums="
2a327b4c2e00fc6afda503548d5bc285d4f120892c75ec6633201825e39e3003a8b8d827053364dc444b72ff728a82381769941c023d8b0a66d955417162b735  socat-1.8.0.1.tar.gz
2032b6528cb27b69d8fb6a6f64af32fcc1f6e4934bb0d7c8931b38ab7ad5e27f6f4344a6cf49751fa3178cd725f954e195373362f7d5929e587d7f0309346059  use-linux-headers.patch
22a6e0c2317a9317997c98114daac258ebbcc3d8e58e49a6ebf24781b98967afed47c63807282582fa0909076fe349281f05e4462faacb90e7aabc853903d6e6  netdb-internal.patch
"
